<!--
	作者：779744514@qq.com
	时间：2015-08-20
	描述：不显示声明模型的例子，由于原型继承的关系，
	修改父级对象中的someBareValue会同时修改子对象中的值，但反之则不行，
	首先点击childbutton再点击parentbutton,这个例子充分说明了控制器是复制
	而非引用someBareValue.
	（与nested-controller-using-model.html进行对比分析）
-->
<!doctype html>
<html ng-app="myApp">
<head>
  <script src="js/angular.js"></script>
</head>
<body>

  <div ng-controller="SomeController">
    {{ someBareValue }}
    <button ng-click="someAction()">Communicate to child</button>
    <div ng-controller="ChildController">
      {{ someBareValue }}
      <button ng-click="childAction()">Communicate to parent</button>
    </div>
  </div>

  <script>
    angular.module('myApp', [])
    .controller('SomeController', function($scope) {
      // anti-pattern, bare value反模式，裸值
      $scope.someBareValue = 'hello computer';
      // set actions on $scope itself, this is okay
      //设置$scope本身的操作，这样是没问题的
      $scope.someAction = function() {
      	//分别在someController和childController中设置{{someBareValue}}
        $scope.someBareValue = 'hello human, from parent';
      };
    })
    .controller('ChildController', function($scope) {
      $scope.childAction = function() {
        $scope.someBareValue = 'hello human, from child';
      };
    });
  </script>

</body>
</html>